package com.martin.lib_base.widget

import android.content.Context
import android.util.AttributeSet
import android.view.View
import com.xuexiang.xui.utils.StatusBarUtils

/**
 * @author：Houge
 * @date：2022/3/16 19:12
 * @desc：沉浸式页面填充状态栏用
 */
class StatusBarView : View {
    constructor(context: Context?) : super(context) {}
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {}
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr
    ) {
    }

    constructor(
        context: Context?,
        attrs: AttributeSet?,
        defStyleAttr: Int,
        defStyleRes: Int
    ) : super(context, attrs, defStyleAttr, defStyleRes) {
    }

    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        setMeasuredDimension(
            MeasureSpec.getSize(widthMeasureSpec),
            StatusBarUtils.getStatusBarHeight(context)
        )
    }

}